var drawing = document.getElementById('drawing')
var drawing2 = document.getElementById('drawing2')
var drawing3 = document.getElementById('drawing3')
// 构建图片对象
var img = document.createElement('img')
img.src = './1.png'
if (
  drawing.getContext &&
  drawing2.getContext &&
  drawing3.getContext
) {
  console.log('draw')
  var context = drawing.getContext('2d')
  var context2 = drawing2.getContext('2d')
  var context3 = drawing3.getContext('2d')

  img.onload = function () {
    // 画图像 这里必须要放在 onload 里，要不是图片将会导出失败
    context.drawImage(img, 0, 0)
    context2.drawImage(img, 0, 0, 200, 200)
    context3.drawImage(img, 50, 50, 30, 30, 60, 60, 30, 30)
  }
  // toDataURL 获得操作结果
  // var image = document.createElement('img')
  // image.src = drawing.toDataURL('image/png')
  // document.body.appendChild(image)

}